home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / vidbasic.zip / VCURSOR.ASM < prev    next >
Assembly Source File  |  1990-11-29  |  4KB  |  106 lines

  1. ;«RM82»«TS8,16,24,32,40,48»
  2. ; updated 11/20/90
  3.  
  4. ;============================================================================
  5. ;   Copyright (C) Copr. 1990 by Sidney J. Kelly
  6. ;           All Rights Reserved.
  7. ;           Sidney J. Kelly
  8. ;           150 Woodhaven Drive
  9. ;           Pittsburgh, PA 15228
  10. ;           home phone 412-561-0950 (7pm to 9:30pm EST)
  11. ;============================================================================
  12.  
  13. DOSSEG
  14. .model medium, BASIC
  15. .code
  16.  
  17. ;-------------------------far data area-------------------------------------
  18. EVEN
  19. N_Curs          DW      0
  20. N_Curs_Blk      DW      0
  21.  
  22. ;============================================================================
  23. ; DECLARE SUB CURSET (Mode%)
  24. ; Input:
  25. ;       Mode = 0  turn off cursor
  26. ;            NOTE on a VGA with ANSI.SYS installed it might not be possible
  27. ;            to turn off all attributes of the cursor.
  28. ;       Mode = 1  turn on normal cursor
  29. ;       Mode = 2  turn on half block
  30. ;       Mode = 3  turn on full block
  31. ; Returns:
  32. ;       Nothing
  33. ; Purpose:
  34. ;       Selects attractive cursor sizes over the default QBASIC format.
  35. ;       Complicated because of need to overcome cursor emuation on VGA/EGA
  36. ;       With an EGA/VGA if want a full block cursor, cannot rely on cursor
  37. ;       emulation, must adjust for actual display box.
  38. ;============================================================================
  39.  
  40. EVEN
  41. CURSET Proc FAR BASIC MODE:Ptr
  42.     Cmp     N_Curs,0           ; check if we have done this before
  43.     JNE     Installed          ; yep, we have so don't do it again
  44.  
  45.     Xor     BX,BX              ; set ES to Ram BIOS area
  46.     Mov     ES,BX
  47.     Mov     N_Curs,0B0Ch       ; Assume VGA, EGA or Mono
  48.     Mov     N_Curs_Blk,060Ch
  49.  
  50. EGA_test:
  51.     Mov     AX,1200h           ; have to do this full scale search
  52.     Mov     BX,10h             ; to override cursor emulation
  53.     Int     10h                ; if want full height block cursor
  54.     Cmp     BL,10h             ; EGA changes BL from 10h
  55.     JE      CGA_test
  56.         Test    ES:Byte Ptr [487h],1000b  ;EGA active?, bit 3 of 0040:0087 set?
  57.          JNZ     CGA_test           ; if bit set, then EGA is inactive
  58.         Jmp     short Installed    ; EGA/VGA active so jump ahead
  59.                    ; and use default information
  60. CGA_test:
  61.     Mov     BX,ES:[0463h]      ; look a port info stored in RAM bios
  62.                    ; at 0000:0463h
  63.     Cmp     BL,0B4h            ; test port address for a mono
  64.     JE      Installed          ; correct assumption
  65.     Mov     N_Curs,0607h       ; use CGA cursor format for normal and
  66.     Mov     N_Curs_Blk,0307h   ; for half block too
  67.  
  68. Installed:
  69.     Mov     BX, MODE           ; read Mode% from stack
  70.     Mov     AX, [BX]           ; get from indirect BX
  71.     And     AL,3               ; keep within 0 to 3 range
  72.     Mov     CX,N_Curs          ; Load CX with cursor format
  73.     Or      AL,AL              ; determine action
  74.     JNZ     Not_Off            ; AL <> 0
  75.  
  76. Turn_Off:
  77.     Mov     AX,300H            ; read current cursor values
  78.                    ; fully set AX because so many routines
  79.                    ; use Int 10h in unusual ways
  80.     Xor     BX,BX              ; for page 0
  81.     Int     10h                ; (a work around for a VGA clone problem)
  82.     Or      CH,20h             ; turn off cursor (set bit five of CH)
  83.     Jmp     Short Doit         ; doit
  84.  
  85. Not_Off:
  86.     Cmp     AL,1               ; merely asked to turn on?
  87.     JE      Doit               ; yep so do it
  88.     Cmp     AL,2               ; half block?
  89.     JNE     Full_Block         ; nope, full block
  90.  
  91. Half_Block:
  92.     Mov     CX,N_Curs_Blk      ; get half block format
  93.     Jmp     Short  Doit        ; set it
  94.  
  95. Full_Block:
  96.     XOR     CH,CH              ; AL must have been 3
  97.  
  98. Doit:
  99.     Mov     AX,100h            ; set cursor size
  100.                    ; fully set AX because so many routines
  101.                    ; use Int 10h in unusual ways
  102.     Int     10h                ; call video routine
  103.     Ret                        ; MASM does clean up
  104. CURSET  ENDP
  105. END
  106.